import React, { Component } from 'react'
import axios from 'axios'
export default class search extends Component {
  searchName=()=>{
    const {inputElment:{value:searchKey}}=this
    axios.get(`/api/search?q=${searchKey}`,{
      headers:{
        'X-Client-Info': {"a":"3000","ch":"1002","v":"5.0.4","e":"16096598523872892269887489","bc":"110100"},
        'X-Host': 'mall.film-ticket.film.list'
      }
    })
    .then(
      res=>{
        console.log(res)
      },
      err=>{
        console.log(err)
      }
    )
  }
  render() {
    return (
      <div className="search">
        <input ref={c=>this.inputElment=c} type="text" />&nbsp;
        <button onClick={this.searchName}>search</button>
      </div>
    )
  }
}
